<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue-2.4.0.js"></script>
</head>

<body>
    <div id="app">
        <div>
            <label>
                ID:
                <input type="text" v-model="id">
            </label>
            <label>
                name:
                <input type="text" v-model="name">
            </label>
            <input type="button" value="添加" @click="na">
        </div>
        <p v-for="item in list" :key="item.id">
            <input type="checkbox">
            {{ item.name }}</p>

    </div>
    <div id="app2">
        <h2>{{ dt }}</h2>
    </div>
</body>
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            id: '',
            name: '',
            list: [
                { id: 1, name: '张三' },
                { id: 2, name: '李四' },
                { id: 3, name: '王二' },
                { id: 4, name: '麻子' }
            ]

        },
        methods: {
            na() {
                this.list.push({ id: this.id, name: this.name })
            }
        }
    })
    var vm = new Vue({
        el:'#app2',
        data:{
            dt:new date()
        }
    })
</script>

</html>